﻿<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="Automator.Tasks.Windows.ScriptTaskEditWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ctrls="clr-namespace:Automator.Tasks.Core.UI;assembly=Automator.Tasks.Core"
    Title="Automator.Tasks.Windows"
    MinWidth="450"
    MinHeight="450"
    ShowInTaskbar="False"
    WindowStartupLocation="CenterOwner"
    ResizeMode="CanResize"
    Background="{x:Static SystemColors.ControlBrush}"
    Height="600"
    Width="600" xmlns:ae="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition
                Height="Auto" />
            <RowDefinition
                Height="*" />
            <RowDefinition
                Height="Auto" />
        </Grid.RowDefinitions>
        <ctrls:EditTaskHeader
            x:Name="header"
            Grid.Row="0" />
        <DockPanel
            LastChildFill="True"
            Grid.Row="1">
            <DockPanel
                LastChildFill="True"
                DockPanel.Dock="Top">
                <TextBlock
                    Margin="8"
                    VerticalAlignment="Center"
                    Text="Header:"
                    MinWidth="45"
                    DockPanel.Dock="Left" />
                <ComboBox
                    Margin="0,4,8,4"
                    VerticalContentAlignment="Center"
                    MinWidth="100"
                    x:Name="cmbLanguage"
                    DockPanel.Dock="Right"
                    IsReadOnly="True"
                    TabIndex="1" />
                <TextBlock
                    Margin="8"
                    VerticalAlignment="Center"
                    Text="Language:"
                    DockPanel.Dock="Right" />
                <TextBox
                    Margin="0,4,0,4"
                    VerticalContentAlignment="Center"
                    x:Name="edtHeader"
                    TabIndex="0" />
            </DockPanel>
            <TextBlock
                Margin="8,2,8,4"
                Text="Return value of the script can be saved in variable Result (System.Object)"
                DockPanel.Dock="Top"
                FontStyle="Italic" />
            <ListView
                x:Name="lstErrors"
                SelectionMode="Single"
                DockPanel.Dock="Bottom"
                Height="120"
                Margin="4,2,4,4">
                <ListView.View>
                    <GridView>
                        <GridViewColumn
                            Width="30"
                            DisplayMemberBinding="{Binding Path=Line}"
                            Header="Line" />
                        <GridViewColumn
                            Width="30"
                            DisplayMemberBinding="{Binding Path=Column}"
                            Header="Column" />
                        <GridViewColumn
                            Width="70"
                            DisplayMemberBinding="{Binding Path=ErrorNumber}"
                            Header="Number" />
                        <GridViewColumn
                            Width="400"
                            Header="Error Text">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock
                                        VerticalAlignment="Top"
                                        HorizontalAlignment="Stretch"
                                        Text="{Binding Path=ErrorText}"
                                        TextWrapping="Wrap"
                                        Margin="2,4,2,4" />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
            <StackPanel
                Orientation="Horizontal"
                DockPanel.Dock="Bottom">
                <Button
                    Content="Check for errors"
                    Margin="4,2,4,2"
                    Padding="4"
                    x:Name="btnCompile"
                    Click="BtnCompile_Click" />
            </StackPanel>
            <ae:TextEditor
                BorderThickness="1"
                Margin="4"
                ShowLineNumbers="True"
                WordWrap="True"
                FontFamily="Consolas"
                FontSize="13"
                x:Name="edtText"
                TabIndex="2" />
        </DockPanel>
        <ctrls:EditTaskFooter
            x:Name="footer"
            Grid.Row="3" />
    </Grid>
</Window>